/*
 * Copyright (c) 2010 CCX(China) Co.,Ltd. All Rights Reserved.
 *
 * This software is the confidential and proprietary information of
 * CCX(China) Co.,Ltd. ("Confidential Information").
 * It may not be copied or reproduced in any manner without the express 
 * written permission of CCX(China) Co.,Ltd.
 *
 * Author: zhaosj
 * Date: 2010-10-12 下午04:19:04
 */
package com.math;

import java.math.BigDecimal;

/**
 * @author zhaosj
 * 
 *         greatest common factor 最大公约数
 */
public class Gcf {

	/**
	 * 求最大公约数
	 * 
	 * @param a
	 * @param b
	 * @return
	 */
	public String gcf(int a, int b) {

		if (b > 0) {
			System.out.println("(" + a + "," + b + ") " + a / b + " ... " + a % b);
			return gcf(b, a % b);
		} else
			return "最大公约数是：" + a;

	}

	public void calc(int a, int b) {
		System.out.println(Math.pow(a, b));
	}

	public static void main(String[] args) {

		Gcf gcf = new Gcf();

		// System.out.println(gcf.gcf(Integer.parseInt(args[0]),Integer.parseInt(args[1]))) ;

		System.out.println(gcf.gcf(123456, 7890));

		gcf.calc(2, 32);

	}

}
